package com.example.common;

/**
 * thread local封装工具类 保存和获取用户id
 * 单个线程有效
 */
public class BaseContext {

    private static ThreadLocal<Long> threadLocal = new ThreadLocal<Long>();

    public static void setCurrentId(Long id) {
        threadLocal.set(id);
    }

    public static Long getCurrentId() {
        return threadLocal.get();
    }
}
